﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ERTesting.Model.Config;
using ERTesting.Model.Result;

namespace ERTesting.Dao
{
    public interface ITestResultService
    {

        /// <summary>
        /// Returns all the result sets for the scenario from previous runs. 
        /// </summary>
        /// <param name="scenario">The scenario for which to get the results for.</param>
        /// <param name="callback">Called with the results sets for the scenario. null if an error occured.</param>
        void GetAllResults(Scenario scenario, Action<IEnumerable<ScenarioResult>, Exception> callback);

        /// <summary>
        /// Saves the result set to the result store.
        /// </summary>
        /// <param name="scenarioResult">The result set to save.</param>
        /// <param name="callback">Called with the result of the operation.</param>
        void SaveResult(ScenarioResult scenarioResult, Action<ScenarioResult, Exception> callback);

        /// <summary>
        /// Returns a new unique id for the result set.
        /// </summary>
        /// <returns>A unique ID string.</returns>
        string GetNewResultId();

        /// <summary>
        /// Gets the outputs that were saved for a result.
        /// </summary>
        /// <param name="scenarioResult">The result set to get the outputs for.</param>
        /// <param name="callback">The callback method to pass the results to.</param>
        void GetOutputsForResult(ScenarioResult scenarioResult, Action<IEnumerable<TestOutput>, Exception> callback);

        /// <summary>
        /// Gets the baseline for the scenario result. If none has been set the most recent passing result is returned. If no results are a pass or no results exist then null is returned.
        /// </summary>
        /// <param name="scenarioResult">The result set to get the baseline for.</param>
        /// <param name="callback">The callback method to pass the baseline to. If result is null, check exception.</param>
        void GetDefaultBaselineResult(ScenarioResult scenarioResult, Action<ScenarioResult, Exception> callback);
    }
}
